<?php
// SomeryC, a webcomic script by Zachary Weston Lewis
// Based on Somery by Robin de Graaf
// Copyright 2005-2006
// SomeryC is distributed under the Artistic License (see LICENSE.txt)
//
// ADMIN/SETTINGS.PHP > 31-08-2007

$start = TRUE; include("system/include.php"); if ($checkauth) { ?> 
<h1 id="settings">Settings</h1> 
<?php  
if ($userdata['level'] >= 3) { 
if (!$action) {; ?> 
<?php loadsettings(); ?> 
<h2>general settings</h2>
<table cellpadding=0 cellspacing=0 border=0><tr><td> 
<form method="post" action="settings.php"> 
<input type="hidden" name="action" value="update"> 
</td></tr></table> 
<table cellpadding=0 cellspacing=0 border=0> 
<tr><td width=175>skin</td><td><select name='set_skindir'> 
<?php 
   $dir ="skins/"; 
   $handle=opendir($dir); 
   $i=0; 
   while ($file = readdir($handle)) { 
         $skins[$i]=$file; 
         $i=$i+1; 
   } 
   closedir($handle); 
   arsort($skins); 
   $e = "1"; 
   while ($e != ($i-1)) { 
      $setskin = ereg_replace("skins","",$skindir); 
      $setskin = ereg_replace("/","",$setskin); 
      if ($skins[$i-$e] == $setskin) {  
         echo "<option value='".$skins[$i-$e]."' selected>".$skins[$i-$e];  
      } else {  
         echo "<option value='".$skins[$i-$e]."'>".$skins[$i-$e];  
      } 
      $e++; 
   } 
?> 
</select></td></tr> 
<tr><td width=175>start level</td><td><select name='set_startlevel'> 
<?php 
   $e = "0"; 
   while ($e < 4) { 
      if ($e == $settings['startlevel']) {  
         echo "<option value='$e' selected>level $e";  
      } else {  
         echo "<option value='$e'>level $e";  
      } 
      $e++; 
   } 
?> 
</select></td></tr> 
<tr><td width=175>posts start status</td><td><select name='set_startstatus'> 
<?php 
   $es[0] = "hidden"; 
   $es[1] = "visible"; 
   $e = "0"; 
   while ($e < 2) { 
      if ($e == $settings['startstatus']) {  
         echo "<option value='$e' selected>$es[$e]";  
      } else {  
         echo "<option value='$e'>$es[$e]";  
      } 
      $e++; 
   } 
?> 
</select></td></tr> 
<tr><td width=175>allow registration</td><td> 
<?php 
   $e = "0"; 
   echo "<input type='checkbox' name='set_registration' "; 
      if ($settings['registration'] == 1) echo "CHECKED";  
   echo ">"; 
?> 
</td></tr> 
<tr><td width=175>allow comments</td><td> 
<?php 
   $e = "0"; 
   echo "<input type='checkbox' name='set_comments' "; 
      if ($settings['comments'] == 1) echo "CHECKED";  
   echo ">"; 
?> 
</td></tr> 
<tr><td width=175>comics per page</td><td><input size=3 name='set_noposts' type='text' value='<?php echo $settings[noposts];?>'></td></tr>
<tr><td width=175>comics in archive</td><td><input size=3 name='set_archive' type='text' value='<?php echo $settings[archive];?>'> 0 shows all</td></tr>
<tr><td width=175>no comments text</td><td><input size=50 name='set_nocomments' type='text' value='<?php echo $settings[nocomments];?>'></td></tr> 
<tr><td width=175>time difference</td><td><input size=3 name='set_gmt' type='text' value='<?php echo $settings[gmt];?>'> server time: <?php echo date("H:i:s"); ?></td></tr>
<tr><td colspan='2'><input type='submit' value='Save Changes' /></td></tr>
</table><br> 
<?php } elseif ($action == "update") { 
   if ($set_registration == "on") { $set_registration = "1"; } else { $set_registration = "0"; } 
   if ($set_comments == "on") { $set_comments = "1"; } else { $set_comments = "0"; } 
   $result = mysql_query("UPDATE ".$prefix."settings SET  
      skindir='$set_skindir', 
      startlevel='$set_startlevel', 
      gmt='$set_gmt', 
      startstatus='$set_startstatus', 
      registration='$set_registration', 
      comments='$set_comments', 
      noposts='$set_noposts', 
      archive='$set_archive', 
      nocomments='$set_nocomments'"); 
   echo "<meta http-equiv=Refresh content=0;URL='settings.php'>"; 
}; 
}; ?> 
<?php }; $start = FALSE; include("system/include.php"); ?>
